<?php
class Custom_Validate_Quarteroverlap extends Zend_Validate_Abstract
{
	const QUARTEROVERLAP = 'quarteroverlap';
	 
	protected $_messageTemplates = array(
			self::QUARTEROVERLAP => 'Dates overlap different quarters! Please enter one promotion per quarter!'
	);
	 
	public function isValid($value, $context = null)
		{
	 		//convert values into Dates
			$startDate = new DateTime($context['startDate']);
			$endDate = new DateTime($value);
		
			//compare dates if in the the same quarter, if not throw warning
			if (ceil($startDate->format('m')/3) != ceil($endDate->format('m')/3)) {
				$this->_error(self::QUARTEROVERLAP);
				return false;
			}
	 
			return true;
		}
}

?>